<?php

/**
 * InterventionSap form base class.
 *
 * @method InterventionSap getObject() Returns the current form's model object
 *
 * @package    mercure
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseInterventionSapForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idpriseencharge'    => new sfWidgetFormInputHidden(),
      'idvictime'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Victime'), 'add_empty' => true)),
      'heureordredepart'   => new sfWidgetFormDateTime(),
      'heurearrivee'       => new sfWidgetFormDateTime(),
      'heuredepart'        => new sfWidgetFormDateTime(),
      'natureintervention' => new sfWidgetFormTextarea(),
      'soinsrealises'      => new sfWidgetFormTextarea(),
      'devenir'            => new sfWidgetFormTextarea(),
      'commentaire'        => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'idpriseencharge'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idpriseencharge')), 'empty_value' => $this->getObject()->get('idpriseencharge'), 'required' => false)),
      'idvictime'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Victime'), 'required' => false)),
      'heureordredepart'   => new sfValidatorDateTime(array('required' => false)),
      'heurearrivee'       => new sfValidatorDateTime(array('required' => false)),
      'heuredepart'        => new sfValidatorDateTime(array('required' => false)),
      'natureintervention' => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'soinsrealises'      => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'devenir'            => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'commentaire'        => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('intervention_sap[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'InterventionSap';
  }

}
